Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement SparseObservable.apply_layout #13372

Merged
merged 1 commit into from
Oct 30, 2024

Conversation

jakelishman
Copy link
Member

Summary

This is one more usability method to bring SparseObservable closer inline with SparsePauliOp. The same functionality is relatively easily implementable by the user by iterating through the terms, mapping the indices, and putting the output back into SparseObservable.from_sparse_list, but given how heavily we promote the method for SparsePauliOp, it probably forms part of the core of user expectations.

Details and comments

Built on top of #13298 (though mostly just because it touches similar changes to the error structs).

I only finalised this after the 1.3 feature-freeze period. There's probably no huge necessity to rush it in since it's not going to be used by the primitives before Qiskit 2.0 anyway, though it's nice to get these things early.

There's still compose and evolve to go for SparseObservable, but those are definitely for a later release, because I haven't written them yet, and the tests will take a good amount of time to write still.

@jakelishman jakelishman added on hold Can not fix yet Changelog: New Feature Include in the "Added" section of the changelog mod: quantum info Related to the Quantum Info module (States & Operators) mod: primitives Related to the Primitives module labels Oct 25, 2024
@jakelishman jakelishman requested a review from a team as a code owner October 25, 2024 17:48
@qiskit-bot
Copy link
Collaborator

One or more of the following people are relevant to this code:

  • @Qiskit/terra-core

@coveralls
Copy link

coveralls commented Oct 25, 2024

Pull Request Test Coverage Report for Build 11579733532

Details

  • 65 of 69 (94.2%) changed or added relevant lines in 1 file are covered.
  • 6 unchanged lines in 2 files lost coverage.
  • Overall coverage increased (+0.01%) to 88.681%

Changes Missing Coverage Covered Lines Changed/Added Lines %
crates/accelerate/src/sparse_observable.rs 65 69 94.2%
Files with Coverage Reduction New Missed Lines %
crates/accelerate/src/unitary_synthesis.rs 1 92.2%
crates/qasm2/src/lex.rs 5 91.98%
Totals Coverage Status
Change from base Build 11579524174: 0.01%
Covered Lines: 75399
Relevant Lines: 85023

💛 - Coveralls

This is one more usability method to bring `SparseObservable` closer
inline with `SparsePauliOp`. The same functionality is relatively easily
implementable by the user by iterating through the terms, mapping the
indices, and putting the output back into
`SparseObservable.from_sparse_list`, but given how heavily we promote
the method for `SparsePauliOp`, it probably forms part of the core of
user expectations.
@jakelishman jakelishman force-pushed the sparse-observable/layout branch from ae2e4a4 to e4df147 Compare October 29, 2024 17:58
@jakelishman
Copy link
Member Author

Rebased and no longer on hold.

@jakelishman jakelishman removed the on hold Can not fix yet label Oct 29, 2024
Copy link
Contributor

@Cryoris Cryoris left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍🏻

It's true we don't strictly require this for 1.3 but this looks solid, brief and ready, so I'd say there's no reason to put it off 🙂

@Cryoris Cryoris added this pull request to the merge queue Oct 30, 2024
Merged via the queue into Qiskit:main with commit 280c4dc Oct 30, 2024
16 checks passed
@jakelishman jakelishman deleted the sparse-observable/layout branch October 30, 2024 10:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Changelog: New Feature Include in the "Added" section of the changelog mod: primitives Related to the Primitives module mod: quantum info Related to the Quantum Info module (States & Operators)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants